<?php
	/**
  * Elgg delete ratecomment action
  */
	// Ensure we're logged in
	if (!isloggedin()) forward();
	// Make sure we can get the comment in question
	$rateannotation_id = (int) get_input('rateannotation_id');
  
	if ($comment = get_annotation($rateannotation_id)) {
    $entity = get_entity($comment->entity_guid);
    /*$annotations=get_annotations($entity->getGUID(),$entity->type,$entity->subtype,'generic_rate',"",$comment->owner_guid,10,0,"asc");
    print_r($annotations);die;*/
    if ($comment->canEdit() ) {
      $comment->delete();
      system_message(elgg_echo("generic_comment:deleted"));
      forward($entity->getURL());
    }
  }
  else {
    $url = "";
  }
  register_error(elgg_echo("generic_comment:notdeleted"));
  forward($entity->getURL());
?>